package com.u17.controller;

import com.u17.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 秦川熙
 */
@RestController
@RequestMapping(value = "/userInfo")
@CrossOrigin
public class UserInfoController {

    @Autowired
    private UserInfoService userInfoService;

    /**
     * 用户余额递减
     * @param username
     * @param money
     * @return
     */
    @PostMapping(value = "/add")
    public String decrMoney(@RequestParam(value = "username") String username, @RequestParam(value = "money") int money) {
        userInfoService.decrMoney(username, money);
        return "success";
    }
}
